package jmine.tec.persist.schema.tableperclass.list;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.SequenceGenerator;

import jmine.tec.persist.annotation.Alias;
import jmine.tec.persist.annotation.Comment;
import jmine.tec.persist.annotation.Comments;
import jmine.tec.persist.annotation.Index;

import org.hibernate.annotations.CollectionOfElements;
import org.hibernate.annotations.IndexColumn;

import bancosys.tec.component.Documentation;
import bancosys.tec.persist.bussobj.PersistableBusinessObject;

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@SequenceGenerator(name = "SEQ_PRCLAS", sequenceName = "SEQ_PRCLAS")
public abstract class AbstractTablePerClassListEntity extends PersistableBusinessObject {

    private Long id;

    private String mnemonico;

    private List<String> strings;

    /**
     * @return the id
     */
    @Id
    @GeneratedValue(generator = "SEQ_PRCLAS")
    @Column(name = "COD_PER_CLASS", precision = 17, nullable = false)
    @Documentation("CODIGO")
    public Long getId() {
        return this.id;
    }

    /**
     * @return the mnemonico
     */
    @Column(name = "MNE", length = 20, nullable = false)
    @Documentation("MNEMONICO")
    public String getMnemonico() {
        return this.mnemonico;
    }

    /**
     * @return the strings
     */
    @Index(suffix = "JT_0", columns = "COD_PER_CLASS")
    @Alias("PRCSTL")
    @CollectionOfElements
    @JoinTable(name = "TABLE_PER_CLASS_STRINGS", joinColumns = @JoinColumn(name = "COD_PER_CLASS", nullable = false))
    @IndexColumn(name = "IDX")
    @Column(name = "PER_CLASS_STRING", length = 12, nullable = false)
    @Comments({ @Comment(table = "TABLE_PER_CLASS_STRINGS", value = "TABELA LISTA STRINGS"),
            @Comment(table = "TABLE_PER_CLASS_STRINGS", column = "COD_PER_CLASS", value = "CODIGO DO PER CLASS OWNER"),
            @Comment(table = "TABLE_PER_CLASS_STRINGS", column = "IDX", value = "INDICE NA LISTA"),
            @Comment(table = "TABLE_PER_CLASS_STRINGS", column = "PER_CLASS_STRING", value = "STRING DA ENTRADA NA LISTA") })
    public List<String> getStrings() {
        return this.strings;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param mnemonico the mnemonico to set
     */
    public void setMnemonico(String mnemonico) {
        this.mnemonico = mnemonico;
    }

    /**
     * @param strings the strings to set
     */
    public void setStrings(List<String> strings) {
        this.strings = strings;
    }
}
